package com.roncoo.education.system.feign.biz;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.roncoo.education.common.service.BaseBiz;
import com.roncoo.education.system.dao.SysRoleUserDao;
import com.roncoo.education.system.dao.impl.mapper.entity.SysRoleUser;

import lombok.RequiredArgsConstructor;

/**
 * 用户角色
 *
 * @author wujing
 */
@Component
@RequiredArgsConstructor
public class FeignRoleUserBiz extends BaseBiz {

    @Autowired
    private SysRoleUserDao sysRoleUserDao;

    public boolean isOnlyResourceManager(Long userId) {
    	List<SysRoleUser> sysRoleUserList = sysRoleUserDao.listByUserId(userId);
    	if (sysRoleUserList != null && sysRoleUserList.size() == 1) {
    		SysRoleUser roleUser = sysRoleUserList.get(0);
    		if (roleUser.getRoleId() == 2L) {
    			return true;
    		}
    	}
    	return false;
    }
}
